package icu.qx.diagram.service.impl;

import icu.qx.diagram.domain.Outbound;
import icu.qx.diagram.mapper.OutboundMapper;
import icu.qx.diagram.service.IOutboundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class OutboundSerivceImpl implements IOutboundService {

    @Autowired
    private OutboundMapper outboundMapper;

    /**
     * 产量统计
     * @param outbound
     * @return
     */
    @Override
    public List<Outbound> selectOutboundList(Outbound outbound) {
        List<Outbound> outboundList=outboundMapper.selectOutboundList(outbound);
        for (Outbound o : outboundList) {
            if(o.getReportGood()==null||o.getScheduleNum()==null){
                o.setRate("0%");
            }else{
                o.setRate(((double)o.getReportGood()/(double)o.getScheduleNum()*100)+"%");
            }
        }
        return outboundList;
    }
}
